package cn.historia.domain.strategy.event;

import cn.historia.types.event.BaseEvent;
import org.apache.commons.lang3.RandomStringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.Map;

/**
 * @package: cn.historia.domain.strategy.event
 * @className: StrategyAwardZeroMessageEvent
 * @author: 云溪
 * @description: 抽奖奖品清零消息
 * @date: 2025/9/29 10:29
 * @version: 1.0
 */
@Component
public class StrategyAwardZeroMessageEvent extends BaseEvent<Map<String, Object>> {

    @Value("${spring.rabbitmq.topic.strategy_award_stock_zero}")
    private String topic;

    @Override
    public EventMessage<Map<String, Object>> buildEventMessage(Map<String, Object> awardStockZeroMap) {
        return BaseEvent.EventMessage.<Map<String, Object>>builder()
                .id(RandomStringUtils.randomNumeric(11))
                .timestamp(new Date())
                .data(awardStockZeroMap)
                .build();
    }

    @Override
    public String topic() {
        return topic;
    }
}
